/*
 *	Copyright (C) 2008 - Mauricio Bieze Stefani
 *	This file is part of the Insano Game Engine.
 *
 *	Insano is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *
 *	Insano is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with Insano.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "Entity.h"

irr::scene::ISceneManager* Entity::smgr = NULL;

Entity::Entity(const Entity& other)
{
	setMesh(other.mesh);
	setNode(Entity::smgr->addAnimatedMeshSceneNode(	other.mesh,
													0,	// parent
													-1,	// id
													other.getPosition(),
													other.getRotation(),
													other.getScale() ));

	setTexture(other.texture);
	collisionTranslate=other.collisionTranslate;
	cameraTranslate=other.cameraTranslate;
	animation=other.animation;
	resetAction(other.action);
}

Entity::~Entity()
{
	if(node)
		node->remove();
}

Entity& Entity::operator=(Entity& ent)
{
	action=ent.action;
	mesh=ent.mesh;
	node=ent.node;
	texture=ent.texture;
	collisionTranslate=ent.collisionTranslate;
	cameraTranslate=ent.cameraTranslate;
	animation=ent.animation;
	return *this;
}

Creature::Creature(const Creature& other) : Entity(other)
{
}

Creature& Creature::operator=(Creature& cre)
{
	Entity::operator=(cre);
	return *this;
}

PlayerChar::PlayerChar(const PlayerChar& other) : Creature(other)
{
}

PlayerChar& PlayerChar::operator=(PlayerChar& pc)
{
	Creature::operator=(pc);
	return *this;
}
